﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using Microsoft.WindowsMobile.Forms;

namespace SmartDeviceProject1
{
    public partial class Form1 : Form
    {
        private string username;
        private string password;
        public Form1(string user, string pwd)
        {
            username = user;
            password = pwd;
            this.Resize += new EventHandler(Form1_Resize);
            
            InitializeComponent();
        }

        ~Form1()
        {
        }

        private void Form1_Resize(object sender, EventArgs e)
        {
            Console.Write(e);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string apppath = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;
            apppath = Path.GetDirectoryName(apppath);
            string path = Path.Combine(apppath, "test.xml");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Random r = new Random();
            this.BackColor = Color.FromArgb(r.Next());
            
        }

        private void notification1_ResponseSubmitted(object sender, Microsoft.WindowsCE.Forms.ResponseSubmittedEventArgs e)
        {

        }

        private void dataGrid1_CurrentCellChanged(object sender, EventArgs e)
        {

        }

        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void menuItem1_Click(object sender, EventArgs e)
        {
            ListViewItem newItem = new ListViewItem("here is a new user:" + username + "; pwd=" + password);
            newItem.ImageIndex = 2;
            this.listView1.Items.Add(newItem);
        }

        private void menuItem2_Click(object sender, EventArgs e)
        {
            CameraCaptureDialog ccd = new CameraCaptureDialog();
            string apppath = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;
            apppath = Path.GetDirectoryName(apppath);
            string path = Path.Combine(apppath, "1.jpg");
            ccd.DefaultFileName = "1.jpg";
            DialogResult dr = ccd.ShowDialog();
            if (dr == DialogResult.OK)
            {
                
            }
        }

        private void menuItem3_Click(object sender, EventArgs e)
        {
            DialogResult dr = openFileDialog1.ShowDialog();
            if (dr == DialogResult.OK)
            {
                Console.Write("ok");
            }
        }
    }
}